package com.sugar.real.estate.module.business.dal.mysql.dicttype;

import com.sugar.real.estate.framework.common.pojo.PageParam;
import com.sugar.real.estate.framework.common.pojo.PageResult;
import com.sugar.real.estate.framework.mybatis.core.mapper.BaseMapperX;
import com.sugar.real.estate.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.sugar.real.estate.module.business.dal.dataobject.dicttype.BizDictDataDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 字典数据 Mapper
 *
 * @author Ysugar
 */
@Mapper
public interface BizDictDataMapper extends BaseMapperX<BizDictDataDO> {

    default PageResult<BizDictDataDO> selectPage(PageParam reqVO, Long dictTypeId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizDictDataDO>()
            .eq(BizDictDataDO::getDictTypeId, dictTypeId)
            .orderByDesc(BizDictDataDO::getId));
    }

    default int deleteByDictTypeId(Long dictTypeId) {
        return delete(BizDictDataDO::getDictTypeId, dictTypeId);
    }

	default int deleteByDictTypeIds(List<Long> dictTypeIds) {
	    return deleteBatch(BizDictDataDO::getDictTypeId, dictTypeIds);
	}

}
